package com.design.pattern.state;

import com.design.pattern.state.Dto.OrderInfoDTO;

/**
 * 订单状态的抽象基类
 */
public abstract class AbstractOrderState implements OrderState{

    /**
     * 订单流转到当前这个状态
     * @param order 订单
     */
    @Override
    public void doTransition(OrderInfoDTO order)  {
        //1获取订单状态
        Integer orderStatus = getOrderStatus(order);
        order.setOrderStatus(orderStatus);
        System.out.println("操作DB修改订单状态");
//        orderInfoDAO.updateStatus(order.getId(), orderStatus);
    }
    /**
     * 获取订单状态
     * @param order 订单
     * @return 订单状态
     * @throws Exception
     */
    protected abstract Integer getOrderStatus(OrderInfoDTO order);

}
